/**
 * 
 */
package gmu.drr.entity.structure;

import org.apache.commons.collections15.*;

import edu.uci.ics.jung.io.graphml.*;
import gmu.drr.entity.DomainVertex;
import gmu.drr.entity.DomainVertexType;

/**
 * @author RothmD01
 *
 */
public class Vertex {
	public String idName;
	public DomainVertexType domainType = DomainVertexType.UNKNOWN;
	public DomainVertex domainVert = null;
	
	public double quince;
	public double sept;
	
	public static Transformer<NodeMetadata, Vertex > getTransformerFromMLMeta() {
		return new VertexFromMLMeta();
	}
	public static Transformer<Vertex, String> getTransformerVertIDs() {
		return new VertIDs();
	}
	public static Transformer<Vertex, String> getTransformerVertDomainTypeDat() {
		return new VertDomainTypeDat();
	}
	public static Transformer<Vertex, String> getTransformerVertQuinceDat() {
		return new VertQuinceDat();
	}
	public static Transformer<Vertex, String> getTransformerVertSeptDat() {
		return new VertSeptDat();
	}
}

class VertexFromMLMeta implements Transformer<NodeMetadata, Vertex > {

	@Override
	public Vertex transform(
			NodeMetadata arg0) {
		Vertex v;
		v = new Vertex();
		v.idName = arg0.getId();
		String intermed;
		intermed = arg0.getProperty("domainType");
		v.domainType = DomainVertexType.valueOf( intermed );
		intermed = arg0.getProperty("quince");
		v.quince = Double.parseDouble( intermed );
		intermed = arg0.getProperty("sept");
		v.sept = Double.parseDouble( intermed );
		// TODO fill in data from the vertex metadata
		return v;
	}		
}

class VertIDs implements Transformer<Vertex, String> {
	public String transform( Vertex v ) {
		String s;
		s = new String( v.idName );
		return s;
	}
}

class VertDomainTypeDat implements Transformer<Vertex, String> {
	public String transform( Vertex v ) {
		String s;
		s = String.valueOf(v.domainType);
		return s;
	}
}

class VertQuinceDat implements Transformer<Vertex, String> {
	public String transform( Vertex v ) {
		String s;
		s = String.valueOf(v.quince);
//		s = (new Double(v.quince)).toString();
		return s;
	}
}

class VertSeptDat implements Transformer<Vertex, String> {
	public String transform( Vertex v ) {
		String s;
		s = String.valueOf(v.sept);
//		s = (new Double(v.sept )).toString();
		return s;
	}
}